package com.hopu.dy.controller;

import com.hopu.dy.pojo.CommentNotice;
import com.hopu.dy.service.ICommentNoticeService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/commentnotices") // 接口路径，与其他提醒区分
public class CommentNoticeController {

    @Resource
    private ICommentNoticeService commentNoticeService; // 注入评论提醒 Service

    /**
     * 创建评论提醒
     * 前端调用示例：
     * POST /api/comment-notices
     * 请求体：{"commentedUserId": 100, "commenterId": 201, "videoId": 301, "commentContent": "很棒的视频"}
     */
    @PostMapping
    public void createCommentNotice(@RequestBody CommentNotice notice) {
        commentNoticeService.createCommentNotice(notice);
    }

    /**
     * 查询某个用户收到的评论提醒
     * 前端调用示例：
     * GET /api/comment-notices?commentedUserId=100
     */
    @GetMapping
    public List<CommentNotice> getCommentNotices(@RequestParam Long commentedUserId) {
        return commentNoticeService.getCommentNotices(commentedUserId);
    }
}
